﻿using System.Collections.Generic;

namespace Framework.Core.Domain
{
    public interface IDaoBase<T, IDT>
    {
        /// <summary>
        /// 通过ID得到实体
        /// </summary>
        /// <param name="entityId"></param>
        /// <param name="shouldLock"></param>
        /// <returns></returns>
        T GetById(IDT entityId, bool shouldLock);

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        IList<T> GetAll();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        void Save(T entity);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        void Update(T entity);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        void SaveOrUpdate(T entity);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entity"></param>
        void Delete(T entity);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="conditions"></param>
        /// <param name="startIndex"></param>
        /// <param name="count"></param>
        /// <param name="sortInfo"></param>
        /// <returns></returns>
        IList<T> GetByConditions(List<string> conditions, int startIndex, int count, SortInfo sortInfo);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="conditions"></param>
        /// <returns></returns>
        int GetCountByConditions(List<string> conditions);
    }
}
